<?php
class Players {

	public function __construct(){
		FunctionsHelper::includeFiles(
			array(
				PUBLIC_MODELS_DIRECTORY . 'model.php',
				PUBLIC_MODELS_DIRECTORY . 'player.php',
				PUBLIC_MODELS_DIRECTORY . 'country.php'
			)
		);
	}
	
	public function GetTopTen($Nationality = null, $Sex = "M"){
		//empty $Nationality means all around the world.
		
		$arrPlayers = array();
		$id = 0;
		if (!empty($Nationality)){
			$country = new Country();
			$country = $country->getByName($Nationality);
			$id = $country->getId();
		}
		
		$player = new Player();
		$arrPlayers = $player->GetTopTen($id, $Sex);
		
		foreach($arrPlayers as $Player){
			$country = new Country(
				array(
					"id" => $Player->getCountryId()
				)
			);
			$Player->setCountryId($country);
		}

		return $arrPlayers;
	}
}
?>